package com.biodiv.community.enums;

public enum ErrorEnum {

    SUCCESS(200, "成功"),
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不支持"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),

    // 业务错误码
    VALIDATION_ERROR(10001, "参数验证失败"),
    INVALID_PARAMETER(10002, "无效参数"),

    USER_NOT_FOUND(10001, "用户不存在"),

    RESOURCE_NOT_FOUND(10003, "资源未找到"),
    DATABASE_ERROR(10004, "数据库错误"),
    BUSINESS_ERROR(10005, "业务处理失败");

    private final int code;
    private final String message;

    ErrorEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
